package com.tvunetworks.center.device.service.impl;

import com.tvunetworks.center.device.mapper.CustomizedUgcRecordMapper;
import com.tvunetworks.center.device.model.CustomizedUgcRecord;
import com.tvunetworks.center.device.service.CustomizedUgcRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @program: tvucc-aggregator
 * @description: CustomizedUgcRecordServiceImpl
 * @author lebronchen
 * @create: 2020-05-13 14:53
 **/
@Service
@Slf4j
public class CustomizedUgcRecordServiceImpl extends BaseService<CustomizedUgcRecord> implements CustomizedUgcRecordService {

    @Autowired
    private CustomizedUgcRecordMapper customizedUgcRecordMapper;

    @Override
    public void addRecord(CustomizedUgcRecord ugcRecord) {
        super.insert(ugcRecord);
    }

    @Override
    public CustomizedUgcRecord getMostRecentUGCRecordByUGCAccountIdAndTid(String ugcAccountId, String tid) {
        if (StringUtils.isBlank(ugcAccountId) || StringUtils.isBlank(tid)) {
            return null;
        }
        return customizedUgcRecordMapper.getMostRecentUGCRecordByUGCAccountIdAndTid(ugcAccountId, tid);
    }
}
